<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div></div>
</body>
<script>
    function Car(name,color){
        this.name = name
        this.color = color
    }
    let car_1 = new Car('小米','红色')
    console.log(car_1);
    /* 
    constructor:构造器，构造函数

    任何函数都有constructor属性，实例化对象的constructor属性指向构造函数
    */
   console.log(car_1.constructor);
</script>
<script>
    // BOM对象  DOM对象  数组  函数  自定义对象  内置对象
    console.log(history.constructor);  //ƒ History() { [native code] }
    console.log(document.getElementsByTagName('div')[0].constructor);  //ƒ HTMLDivElement() { [native code] }
    var arr = [1,2,3]
    console.log(arr.constructor);  //ƒ Array() { [native code] }
    var obj = {
        name:'zs'
    }
    console.log(obj.constructor);  //ƒ Object() { [native code] }
    console.log(new Date().constructor);  //ƒ Date() { [native code] }
</script>
<script>
    // 判断数据类型
    var num = 10
    console.log(num.constructor);
    console.log(num.constructor == Number);
    var str = '123'
    console.log(str.constructor == String);
</script>
</html>